<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link rel="stylesheet" type="text/css" href="<?php echo $this->_webroot('skin/css/admin.css'); ?>">
<link rel="stylesheet" type="text/css" href="<?php echo $this->_webroot('skin/css/main.css'); ?>">
<script language="JavaScript" src="<?php echo $this->_webroot('servtools/ajax_client/ajax.js'); ?>"></script>
<script type="text/javascript">
function ltrim(str){ //删除左边的空格   
	 return str.replace(/(^\s*)/g,"");   
}
//text
function edit(obj,id,inputname,url,param,size){
	var uright=document.getElementById("update_right");
	var div1=obj.nextSibling;
	if(div1.nodeType!=1){
      div1=div1.nextSibling;
	}
	if(uright!='0'){
	obj.style.display="none";
     var spanvalue=obj.innerHTML;
     var spaninput="<input type=text id='"+inputname+"' onblur=\"editpost(this,'"+id+"','"+url+"','"+param+"');\" size="+size+" maxlength='100' value='"+spanvalue+"' />";
     div1.innerHTML=spaninput;
     div1.style.display="block";
     
     document.getElementById(inputname).focus();
  }else{
	    ShowMessageBox("对不起，您没有权限不能修改！",'m.php?app=error');
		// location.href="m.php?app=error";
	}
}
function editpost(obj,id,url,param){
	var div1=obj.parentNode;
	var span1=div1.previousSibling;
	if(span1.nodeType!=1){
		span1=span1.previousSibling;
	}
	if(obj.value==span1.innerHTML){
      div1.style.display="none";
      span1.style.display="block";
	}else{
      ajax(url,"POST",param+obj.value,function(data){
           if(data==1){
          	 div1.style.display="none";
          	 span1.innerHTML=obj.value;
               span1.style.display="block";
           }else{
          	 ShowMessageBox("更新失败",'1');
          	   div1.style.display="none";
               span1.style.display="block";
               }
      });
	}
	
}
//带有数字验证
function editnum(obj,id,inputname,url,param,size){
	var uright=document.getElementById("update_right");
	var div1=obj.nextSibling;
	if(div1.nodeType!=1){
      div1=div1.nextSibling;
	}
	if(uright!='0'){
	obj.style.display="none";
     var spanvalue=obj.innerHTML;
     var spaninput="<input type=text id='"+inputname+"' onblur=\"editpost(this,'"+id+"','"+url+"','"+param+"');\" "+
                   "size="+size+" maxlength='100' value='"+spanvalue+"' onkeypress='return regInput(this,/^[0-9]*$/,String.fromCharCode(event.keyCode))'"+
                   " onpaste= \"return regInput(this,\/^[0-9]*$/,\window.clipboardData.getData('Text'))\" ondrop= \"return regInput(this,/^[0-9]*$/,event.dataTransfer.getData('Text'))\" "+
                   " style=\"ime-mode:Disabled\" />";
     div1.innerHTML=spaninput;
     div1.style.display="block";
     
     document.getElementById(inputname).focus();
  }else{
	    ShowMessageBox("对不起，您没有权限不能修改！",'m.php?app=error');
	}
}
</script>
<script language="JavaScript" src="<?php echo $this->_webroot('skin/js/jy.js'); ?>"></script>
<style>
td span {color:red;}
.green {color:green;}
.red {color:red;}
</style>
</head>
<body>
<input type="hidden" id="update_right" value="1" ></input>
<div id="maincontent">
<psp:tags     htmlname='messagebox'  iconname='messagebox' />
	<div class="wrap">
    <div class="crumbs">当前位置 &gt;&gt; 网站管理 &gt;&gt; 店铺文章分类</div>
        <hr />
	<div class="infobox">
    <h3><span class="left">店铺文章分类</span> <span style="margin-right:15px;" class="right"><a style="float:right;" href="<?php echo $this->_url('admin/shoparticle/categoriesadd');?>">添加分类</a></span></h3>
    <div class="content2">
		<form action="a.php?act=goods_brand_del" name="form1" method="post">
		<table class="list_table" style="font-size:12px;">
		 	<thead>
            <tr style=" text-align:center">
				<th width="30px"><input type="checkbox" value="" onclick="checkall(this,'cat_id[]');"></th>
				<th width="30px">ID</th>
				<th width="" align="left">分类名称</th>
				<th width="80px">类型</th>
				<th width="60px">排序</th>
				<th width="60px">操作</th>
			</tr>
			</thead>
			<tbody>
			<?php if($result) {
			foreach($result as $value) { ?>
			<tr style=" text-align:center">
				<td width="30px"><input type="checkbox" name="cat_id[]" value="<?php echo $value['shoparticlecat']['id'];?>" <?php if($value['shoparticlecat']['parent_id']==-1){echo "disabled"; }?>/></td>
				<td width="30px"><?php echo $value['shoparticlecat']['id'];?></td>
				<td width="" align="left"><a href="m.php?app=news_list&id=<?php echo $value['shoparticlecat']['id'];?>"><?php echo $value['shoparticlecat']['cat_name'];?></a></td>
				<td width="80px"><?php if($value['shoparticlecat']['parent_id']==-1){echo "系统分类";}elseif($value['parent_id']==0){echo "自定义分类";}?></td>
				<td width="60px"><?php echo $value['shoparticlecat']['sort_order'];?></td>
				<td width="60px">
					<a href="<?php echo $this->_url('admin/shoparticle/categoriesedit/'.$value['shoparticlecat']['id']);?>">修改</a>
					<?php if($value['articlecat']['parent_id']!=-1){?>
					<a href="<?php echo $this->_url('admin/shoparticle/categoriesdel/'.$value['shoparticlecat']['id']);?>" onclick="return confirm('删除分类将同时删除分类下所有子分类。确定要删除吗？');">删除</a>
					<?php }?>
				</td>
			</tr>
			<?php }?>
			<tr>
				<td colspan="6">
					<span class="button-container"><input class="regular-button" type="submit" name=""  onclick="return delcheck();" value="批量删除" /></span>
				</td>
			</tr>
			<?php } else { ?>
			<tr>
				<td colspan="6" class="center">暂无信息!</td>
			</tr>
			<?php } ?>

			</tbody>
		</table>
		</form>
	  </div>
	 </div>
	</div>
</div>
<script language="JavaScript">
<!--
var inputs = document.getElementsByTagName("input");

function delcheck(){
	var checked = false; 
    for (var i = 0; i < inputs.length; i++) 
    { 
    	if (inputs[i].checked == true) 
        {
            checked = true;
            if(confirm('确定要执行此操作吗？')){
            	break; 
                }else{
                	return false;
                	break; 
                    }
        }
    } 
    if (!checked) 
    { 
        ShowMessageBox("请至少选择一个标题！",'0'); 
        return false; 
    }
    return true;
}
//-->
</script>
</body>
</html>